From 672e4e4b03d8987103020d399b2c05c95a9ea2f8 Mon Sep 17 00:00:00 2001
From: Rafa Garcia Gallego <rafael.garcia.gallego@gmail.com>
Date: Wed, 26 Mar 2014 23:58:27 +0100
Subject: [PATCH] Fix segfault when pressing PrintScr without a selection

---
 st.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/st.c b/st.c
index e20a1e0..d58af7d 100644
--- a/st.c
+++ b/st.c
@@ -2263,9 +2263,10 @@ tdumpsel(void)
 {
 	char *ptr;
 
-	ptr = getsel();
-	tprinter(ptr, strlen(ptr));
-	free(ptr);
+	if((ptr = getsel())) {
+		tprinter(ptr, strlen(ptr));
+		free(ptr);
+	}
 }
 
 void
-- 
2.20.1